import React from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { Image } from 'semantic-ui-react'
import { CommandBarButton } from 'components/commandBar'
import { global as globalDuck } from 'ducks'

const CommandUser = ({ user }) => (
  <CommandBarButton>
    <Image size="mini" bordered rounded src={user.avatar} className="avatar" />
  </CommandBarButton>
)

const mapStateToProps = state => ({
  user: globalDuck.selectors.user(state),
})

export default connect(mapStateToProps)(CommandUser)
